---
title: Why You Should Choose TiDB
try_it_yourself:
  campaign: insight_database
---
import {CommonChart} from "../src/components/CommonChart";
import ContributorsCharts from "../src/components/ContributorsCharts";
import GroupSelect from "../src/components/GroupSelect";
const tidbGroup = [41986369, 48833910, 53311716]

## ❓ What is tidb

TiDB is an open source distributed Hybrid Transactional and Analytical Processing (HTAP) database compatible with the MySQL protocol.

#### ℹ️  Learn more about TiDB
- Source Code: https://github.com/pingcap/tidb
- Official Website: [https://en.pingcap.com](https://en.pingcap.com/?utm_source=ossinsight&utm_medium=referral)
- Docs: [https://docs.pingcap.com](https://docs.pingcap.com?utm_source=ossinsight&utm_medium=referral)


## 👀 Comparison

Now we can use TiDB as an example, analyze it in four aspects: stars, issues, PRs and contributors. You can also select any repo in the filter box to compare with it.

### Stars

#### The most starred OSDB repos since 2011 (updated 1 hour ago)

The number of stars is an important and commonly used metric to measure the popularity of a repository. We sort all database repositories from GitHub and rank them by their accumulated number of stars.

In this bar chart, we can see that TiDB ranks second in the most starred open source database repos since 2011, which is enough to show that it is very popular in the field of open source databases.

<CommonChart
  chart='barchart'
  category='rt-osdb-ranking-by-stars'
  n={20}
  formatSql={false}
  categoryIndex='repo_group_name'
  valueIndex='num'
  seriesName='Stars'
  categoryType={false}
/>

#### Stargazers from Top 50 Companies in the TiDB repo

We can see which companies (top 50) star the TiDB repo most in this pie chart. Among them, many open source enthusiasts from Chinese Internet giants such as Tencent, Alibaba, and Bytedance expressed their appreciation for TiDB. At the same time, hundreds of developers from Google, Microsoft and Facebook also starred the TiDB repository. It can be seen that TiDB is concerned and welcomed all around the world.

<GroupSelect />

<CommonChart
  chart='piechart'
  category='stars-top-50-company'
  formatSql={false}
  categoryIndex='company_name'
  valueIndex='stargazers'
  categoryType='owner'
  seriesName='Stargazers'
  repoId={tidbGroup}
  comparing
/>

#### Countries/Regions of stargazers

This map will show you which country or region does stargazers come from. They make an issue to report the problem, or request a new feature.

We display the geographic information by all stargazers on the map. They come from 146 countries and regions except for Antarctica. It can be seen that in addition to China (where PingCAP is headquartered), the United States and Europe have gathered the most stargazers, and there are scattered stargazers in other regions. It can also be inferred that TiDB is popular all over the world.

<CommonChart
  chart='worldmapchart'
  category='stars-map'
  formatSql={false}
  categoryIndex='country_or_area'
  valueIndex='count'
  seriesName='stargazers'
  effect={false}
  size={56}
  repoId={tidbGroup}
  comparing
/>

### Issues

Total number of issues, issue submitters, issues comments, and issue commenters since 2011.

Judging from the total number of issues, TiDB repository has a total of 155562 issues(2022-04-06), ranking the top 3 in all open source database repos. We judge the activeness of an open source repository by referring to the number of issues as well. Generally, the higher number of issues means more contributors are involved in a repository, which can presents the active level of it. Therefore, the activity of the TiDB repository can be considered to be at the forefront of the open source database area.

<CommonChart
  chart='barchart'
  category='rt-osdb-ranking-by-issues'
  n={20}
  formatSql={false}
  categoryIndex='repo_group_name'
  valueIndex='num'
  seriesName='Issues'
  categoryType={false}
/>

In order to prevent the phenomenon of submitting issues maliciously(only open but not closed), we can also refer to the average opening/closing time and initial response time of issues in open source database repos to make the evaluation.

#### Median time cost from open issue to close

<CommonChart
  chart='barchart'
  category='rt-osdb-ranking-by-median-issue-open-to-close'
  n={20}
  formatSql={false}
  categoryIndex='repo_group_name'
  valueIndex='days'
  seriesName='Days'
  categoryType={false}
/>

#### Median time cost from open issue to first response

<CommonChart
  chart='barchart'
  category='rt-osdb-ranking-by-median-issue-open-to-first-respond'
  n={20}
  formatSql={false}
  categoryIndex='repo_group_name'
  valueIndex='days'
  seriesName='Days'
  categoryType={false}
/>

#### Countries/Regions of Issue Openers

This map will show you which country or region issue creators come from. They make an issue to report the problem, or request a new feature.

We can see that in addition to China, contributors from 38 countries around the world have submitted issues for the TiDB repository from this map.

<CommonChart
  chart='worldmapchart'
  category='issue-creators-map'
  formatSql={false}
  categoryIndex='country_or_area'
  valueIndex='count'
  seriesName='Issue openers'
  effect={false}
  size={56}
  repoId={tidbGroup}
  comparing
/>

### Pull Requests

Total number of pull requests (PRs), PR creators, PR reviews, and PR reviewers since 2011.

In addition to stars and issues, the number of PRs is an important indicator for measuring the activity of repos. The higher number of PRs, are considered as a repository more active basically. In the following bar chart, the total number of PRs of TiDB ranks No.3 in all open source database repos after elasticsearch and cockroachdb, and the gap with second place is gradually narrowing.

<CommonChart
  chart='barchart'
  category='rt-osdb-ranking-by-prs'
  n={20}
  formatSql={false}
  categoryIndex='repo_group_name'
  valueIndex='num'
  seriesName='PRs'
  categoryType={false}
/>

#### Company of PR Creators about TiDB repository
The pie charts describe the major companies of PR creators for each project.

We can also analyze the origin of PR creators about TiDB. If all PRs come from the same company, the definition of open source will be called into question. We use the pie chart below to show the Top 50 companies of contributors who submitted PRs for TiDB.

Of course, as the parent company of TiDB, PingCAP has become a gathering place for PR creators. But what is surprising is that hundreds of open source enthusiasts from different companies also contributed to TiDB, and their proportion is  more than 60%, far exceeding PingCAP itself. This also shows that TiDB is a real open source database, and the TiDB community is a typical vibrant organization.

<CommonChart
  chart='piechart'
  category='pull-request-creators-top-50-company'
  formatSql={false}
  categoryIndex='company_name'
  valueIndex='code_contributors'
  categoryType='owner'
  seriesName='Contributors'
  repoId={tidbGroup}
  comparing
/>

:::info
If you want to learn company distribution about other repository, please visit: https://ossinsight.io/compare.
:::

#### Countries/Regions of PR Creators
This map shows you where the PR creators come from and which countries or regions welcome the repository the best.

From the perspective of geographical distribution, people who contributed to TiDB can also measure the repository's popularity and diversity in all open source database repos. We can see that TiDB is an active, inclusive, and international open source project in this map.

<CommonChart
    chart='worldmapchart'
    category='analyze-pull-request-creators-map'
    formatSql={false}
    categoryIndex='country_or_area'
    valueIndex='pr_creators'
    seriesName='PR creators'
    effect={false}
    size={56}
    repoId={tidbGroup}
    comparing
/>

#### Heat Map of Commits Time about PRs

We can also analyze the activity of open source repos from the commits time. The figure below shows the time heat map for PRs commits.

The Heat Maps of Commits Time display the number of push events occurring at a particular point of time. The Y-axis represents 7 days a week, and the X-axis represents 24 hours a day according to the Universal Time Coordinated (UTC). The lighter color in this heat map indicates that less push events occur at a particular point of time. On the contrary, the darker color indicates more push events occurring.

From this heat map, we can see that the vast majority of PRs are committed between 2:00 - 16:00 (UTC) indicating that in addition to the vast majority of Chinese contributors, there are also contributors from different time zones who have contributed to TiDB during working hours.

<CommonChart
    chart='heatmapchart'
    category='analyze-commits-time-distribution'
    xIndex='hour'
    yIndex='dayofweek'
    valueIndex='pushes'
    formatSql={false}
    repoId={tidbGroup}
    comparing
/>

#### Median time cost from open pull request to close it

It is unilateral to prove that the repository is active only by the number of submitted PRs. It is also necessary to pay attention to the life cycle of a PR (from open to close) to assist in analyzing the activity and health of open source repos. As you can see from the bar chart below, the PR life cycle length varies widely between repos. On average, hive and ignite take almost 120 days to close a PR, while TiDB, which is also on the list, only takes about 10 days.

<CommonChart
    chart='barchart'
    category='archive/2021/repo-ranking-by-pr-open-to-merge'
    formatSql={false}
    categoryIndex='repo_name'
    valueIndex='days'
    seriesName='Days'
    categoryType={false}
    field='database'
    n={20}
/>

### Contributors

The total number of contributors since 2011 about each repository.

> by Contributors

In addition to the above three criteria for measuring the activity of an open source database repository, some interesting conclusions can be drawn from the analysis from the perspective of contributors.

Usually, a non-full-time contributor will contribute no more than 100 PRs in the same repository (unless he/she is a super fan of the repository). In order to reasonable to assume whether the people participating in the open source community are real community members (not company employees). We group all contributors by the total number of PRs submitted by themselves into <= 10,<= 100,> 100. Then we can get insights of the TiDB community.

In order to obtain a comprehensive and objective analysis result, we recommend that the total number of contributors and the proportion of contributors be compared together. Contributors who submitted less than 10 PRs in the TiDB repository accounted for 76.8% of total PRs which is 806 contributors. There are more than 300 contributors who submitted more than 10 PRs for TiDB. It can be seen that the research and development resources of TiDB are very sufficient, and the quality of the code can be trusted.

#### The percentage of different types of contributors in total contributors

*All contributors are classified according to the total number of PRs submitted by themselves into <= 10,<= 100,> 100.

<ContributorsCharts type='contributors' field="database" percent/>

<ContributorsCharts type='contributors' field="database"/>

> by PRs

We can also measure the health of a repository with the percentage of the total number of PRs submitted by these different types of contributors.
7.4% of contributors created a total of 2082 PRs, 20.3% of contributors created a total of 5093 PRs, and 72.3% of contributors created 20245 PRs. This is a very healthy ratio.

#### The percentage of the sum of PRs submitted by different types of contributors in total PRs
*All contributors are classified according to the total number of PRs submitted by themselves into <= 10,<= 100,> 100.

<ContributorsCharts type='prs' percent field="database"/>

<ContributorsCharts type='prs' field="database"/>
